feat(writer): emit SUM zone-map stat for numeric primitive columns#131
Merged
Conversation
Probed Rust real-file fixtures (tpch_lineitem): numeric primitive and decimal columns carry [MAX, MIN, SUM, NULL_COUNT]; Utf8/extension/date carry [MAX, MIN, NULL_COUNT] (no SUM, even when extension storage is numeric). Closes the SUM half of the Rust-parity stats increment (ADR 0013 §6 aggregate push-down). The writer now computes a per-chunk SUM over each column's logical values (PrimitiveEncodingEncoder.sumStat: signed -> i64, unsigned -> u64, float -> f64; checked i64/u64 overflow -> null zone) and emits it as the SUM(5) field in the zone-map stats table for plain numeric primitives only — flat and dict paths alike, carried on ChunkRef / DictColRef. Validity placeholders are zero (sum-neutral), so nullable columns sum correctly without excluding nulls. Decimal SUM is deferred with decimal min/max. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the SUM half of the Rust-parity zone-map stats increment (pairs with ADR 0013 §6 aggregate push-down). MIN/MAX/NULL_COUNT already shipped.
Ground truth
Probed Rust real-file fixtures (
tpch_lineitem.compact.vortex): numeric primitive + decimal columns carry[MAX, MIN, SUM, NULL_COUNT]; Utf8/extension/date carry[MAX, MIN, NULL_COUNT]— no SUM, even when extension storage is numeric. Java now matches.Changes
PrimitiveEncodingEncoder.sumStat— per-chunk sum over logical values: signed →i64, unsigned →u64, float →f64; checkedi64/u64overflow → null zone (Rust drops it). Validity placeholders are zero (sum-neutral), so nullable columns sum correctly without excluding nulls.VortexWriter— emit SUM(5) in the zone-map stats table for plain numeric primitives only (not extension/utf8/decimal), flat + dict paths alike, carried onChunkRef/DictColRef. SUM is independent of MIN/MAX (a partial-stats column drops MIN/MAX but keeps SUM).Bitsets
Numeric primitive:
0x58→0x78(+SUM). Partial-stats numeric:0x40→0x60. Utf8/extension unchanged.Full
./mvnw verifygreen incl. Java-writes→Rust-reads JNI interop + inspector decode + javadoc.WriterZoneMapTestnow asserts per-zone sums (flat, nullable null-skipping, dict).🤖 Generated with Claude Code